<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page isELIgnored="false" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'slist.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" href="bootstrap-3.3.7/css/bootstrap.css">
    <script type="text/javascript" src="bootstrap-3.3.7/js/jquery-3.3.1.min.js"></script>
	<script type="text/javascript" src="bootstrap-3.3.7/js/bootstrap.min.js"></script>
	<script type="text/javascript">
		function xiugai(sid){
			location="goxiugai?sid="+sid;
		}
		function xiugaia(sid){
			location="goxiugaijs?sid="+sid;
		}
		function xiugaib(sid){
			location="goxiugaiJSP?sid="+sid;
		}
		function xiugaic(sid){
			location="goxiugaiJAVA?sid="+sid;
		}
		function qf(){
			$("[name='ck']").each(function(){
				this.checked = !this.checked;
			});
		}
		function plsc(){
			var ids = $("[name='ck']:checked").map(function(){
				return this.value;
			}).get().join();
			if(ids==null||ids==""){
				alert("请选择要删除的条目！");
			}else{
				if(confirm("是否删除"+ids)){
				$.post(
					"deletebyids",
					{"ids":ids},
					function(obj){
						alert("删除成功！");
						location = "getlist";
					},
					"json"
				);
			}else{
				alert("不删拉倒！");
			}	
			}
		}
		function tjxx(){
			alert("这是添加的方法！");
			location = "goaddstudents";
		}
		
	</script>

  </head>
  
  <body>
    <p style="font-size: 30px;text-align: center;">成员列表</p>
    <table  class="table table-hover">
    	<tr>
    		<th>
    			<button class="btn btn-default" onclick="qf()">全选/反选</button>
    		</th>
    		<th>编号</th>
    		<th>姓名</th>
    		<th>性别</th>
    		<th>年龄</th>
    		<th>爱好</th>
    		<th>部门</th>
    		<th>职位</th>
    		<th>操作</th>
    	</tr>
    	<c:forEach items="${stus }" var="s" varStatus="ss">
    	<tr>
    		<td>
    			<input type = "checkbox" name = "ck" value = "${s.sid}">
    		</td>
    		<td>${ss.count}</td>
    		<td>${s.sname}</td>
    		<td>${s.sex}</td>
    		<td>${s.age}</td>
    		<td>${s.hobby}</td>
    		<td>${s.ectur}</td>
    		<td>${s.rang}</td>
    		<td>
    			<button class="btn btn-success" onclick="xiugai('${s.sid}')">修改</button>
    			<button class="btn btn-success" onclick="xiugaia('${s.sid}')">修改js</button>
    			<button class="btn btn-success" onclick="xiugaib('${s.sid}')">修改jsp</button>
    			<button class="btn btn-success" onclick="xiugaic('${s.sid}')">修改java</button>
    			<button class="btn btn-danger" onclick="plsc()">删除</button>
    		</td>
    	</tr>
    	</c:forEach>
    </table>
    <button class="btn btn-primary" onclick="tjxx()">添加信息</button>
    <button class="btn btn-danger" onclick="plsc()">批量删除</button>
  </body>
</html>
